<?php $this->extend('comm/page');?>

<div class="row">
    <div class="col-md-3 col-sm-4 col-xs-12 mr-b-sm">
        <div class="layui-card">
            <div class="layui-card-header">
                当前组别：<strong id="selectGroup">未选择</strong><small id="groupStatus"></small>
            </div>
            <div class="layui-card-body">
                <?php if($add): ?>
                <div class="text-center mr-b-xs">
                    <button class="btn-sm btn-primary hide" id="btn-refresh-group"><i class="fa fa-refresh"></i></button>
                    <a href="javascript:;" class="btn btn-success" id="btn-add-group" title="新增角色组别"><i class="fa fa-plus"></i> 新增角色组别</a>
                </div>
                <?php endif; ?>
                <input type="hidden" id="selectGroupID">
                <div id="groupTree" class="mr-xs mr-lr-md">加载角色组别数据中...</div>
            </div>
        </div>
    </div>

    <div class="col-md-9 col-sm-8 col-xs-12 mr-b-sm">
        <div class="panel panel-default panel-intro">
            <?php echo $this->build_heading(); ?>
            <div class="panel-body">
                <div id="toolbar" class="toolbar">
                    <?php echo $this->build_toolbar(['refresh', 'edit']); ?>
                    <?php if($this->checkAuth('/admin/sys/auth/group/bind', $userInfo['id'])): ?>
                    <a href="javascript:;" class="btn btn-info btn-access">
                        <i class="fa fa-plus"></i>
                        关联管理员
                    </a>
                    <?php endif; ?>
                </div>
                <table id="table" lay-filter="table" class="mr-b-sm"></table>
            </div>
        </div>
    </div>
</div>


<!-- 操作 -->
<script type="text/html" id="operate">
    <?php if($this->checkAuth('/admin/sys/auth/group/unbind', $userInfo['id'])): ?>
        {{# if(supper_group.indexOf(d.id) < 0){ }}
        <button type="button" class="btn btn-xs btn-primary" lay-event="unbind">
            <i class="fa fa-unlink"> 移除关联</i>
        </button>
        {{# } }}
    <?php endif; ?>
</script>

<script>window.supper_group = JSON.parse('<?php echo $supperGroup;?>');</script>